var http = require('http');

var opts = {
	host: 'localhost',
	port: '8080',
	path: '/a.txt'
};

var callback = (resp) => {
	var body = '';
	resp.on('data', (data) => {
		body += data;
	});
	resp.on('end', () => {
		console.log(body);
	});
};

var req = http.request(opts, callback);

req.end();
